using FubuMVC.Core;
using FubuMVC.Spark;
using thunderdome.Controllers;

namespace thunderdome
{
    public class ThunderdomeRegistry
        : FubuRegistry
    {
        public ThunderdomeRegistry()
        {
            IncludeDiagnostics(true);

            Actions
                .IncludeClassesSuffixedWithController();

            Routes
                .IgnoreControllerNamespaceEntirely()
                .ConstrainToHttpMethod(call => call.InputType().Name.EndsWith("Query"), "GET")
                .ConstrainToHttpMethod(call => call.InputType().Name.EndsWith("Command"), "POST")
                .HomeIs<HomeInputQuery>();

            Views
                .TryToAttachWithDefaultConventions();

            this.UseSpark();
        }
    }
}